/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.financeiro.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "orgao_documento_lista", catalog = "salao", schema = "public")
@NamedQueries({
    @NamedQuery(name = "OrgaoDocumentoLista.findAll", query = "SELECT o FROM OrgaoDocumentoLista o")})
public class OrgaoDocumentoLista implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "orgao_documento_lista_id_lista_seq")
    @SequenceGenerator(name = "orgao_documento_lista_id_lista_seq", sequenceName = "orgao_documento_lista_id_lista_seq", initialValue = 1, allocationSize = 1)
    @Basic(optional = false)
    @Column(name = "id_lista", nullable = false)
    private Integer idLista;
    @JoinColumn(name = "id_documento", referencedColumnName = "id_documento")
    @ManyToOne
    private TipoDocumento idDocumento;
    @JoinColumn(name = "id_orgao", referencedColumnName = "id_orgao", nullable = true)
    @ManyToOne(optional = true, fetch = FetchType.EAGER)
    private OrgaoDocumento idOrgao;

    public OrgaoDocumentoLista() {
    }

    public OrgaoDocumentoLista(Integer idLista) {
        this.idLista = idLista;
    }

    public Integer getIdLista() {
        return idLista;
    }

    public void setIdLista(Integer idLista) {
        this.idLista = idLista;
    }

    public TipoDocumento getIdDocumento() {
        return idDocumento;
    }

    public void setIdDocumento(TipoDocumento idDocumento) {
        this.idDocumento = idDocumento;
    }

    public OrgaoDocumento getIdOrgao() {
        return idOrgao;
    }

    public void setIdOrgao(OrgaoDocumento idOrgao) {
        this.idOrgao = idOrgao;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLista != null ? idLista.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrgaoDocumentoLista)) {
            return false;
        }
        OrgaoDocumentoLista other = (OrgaoDocumentoLista) object;
        if ((this.idLista == null && other.idLista != null) || (this.idLista != null && !this.idLista.equals(other.idLista))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.jm.financeiro.entity.OrgaoDocumentoLista[ idLista=" + idLista + " ]";
    }
    
}
